package com.guaoran.service;

import com.guaoran.jpa.entity.VpgMovie;
import com.guaoran.jpa.entity.VpgPackage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * @author : 孤傲然
 * @Description :
 *  使用jpa方式
 * @date :2018/1/25 13:51
 */
public interface DemoJpaService {
    /**
     * 根据供应商id查询
     * @param providerId
     * @return
     */
    public List<VpgPackage> findVpgPackagesByProviderId(String providerId);
    /**
     * 根据资产id查询
     * @param assetId
     * @return
     */
    public List<VpgPackage> findVpgPackagesByAssetIdContaining(String assetId);
    /**
     * 根据资产名称or资产id模糊查询
     * @param assetName
     * @return
     */
    public List<VpgPackage> findByAssetIdContainingOrAssetNameContaining(String assetId, String assetName);

    /**
     * 通过providerId分页查询和assertName排序
     * @param providerId
     * @param pageable
     * @return
     */
    public Page<VpgPackage> findAllByProviderIdOrderByAssetName(String providerId, Pageable pageable);
    /**
     * 通过providerId分页查询和自定义排序
     * @param providerId
     * @param pageable
     * @return
     */
    public Page<VpgPackage> findAllByProviderId(String providerId, Pageable pageable);

    /**
     * 保存包
     * @param vpgPackage
     * @return
     */
    public VpgPackage saveVpgPackage(VpgPackage vpgPackage);

    /**
     * 保存影片
     * @param vpgMovie
     * @return
     */
    public VpgMovie saveVpgMovie(VpgMovie vpgMovie);

    /**
     * 根据关键字查询影片
     * @param title
     * @param actors
     * @param director
     * @param pageable
     * @return
     */
    public Page<VpgMovie> findDistinctByTitleContainingOrActorsContainingOrDirectorContaining(String title, String actors, String director, Pageable pageable);

    /**
     * 查询影片
     * @param id
     * @return
     */
    public VpgMovie queryMovieById(Long id);

    /**
     * 查询包
     * @param id
     * @return
     */
    public VpgPackage queryPackageById(Long id);

    /**
     * 删除影片
     * @param id
     */
    public void deleteMovieById(Long id);

    /**
     * 删除影片包
     * @param id
     */
    public void deletePackageById(Long id);

    /**
     * 通过包id查询影片
     * @param packageId
     * @return
     */
    public List<VpgMovie> queryByPackageId(Long packageId);
}
